class Student < ActiveRecord::Base
  validates_presence_of :firstname, :lastname, :firstname_th, :lastname_th, :status, :advisor, :nationality,:email, :emergency_contact_name,
  :computer_language, :dob, :emergency_contact_relationship,:emergency_email, :emergency_phone, :father_name,
  :gpa, :id_card_no, :language_english_listening, :language_english_speaking, :language_english_reading,
  :language_english_writing, :military_service, :mother_name, :parent_address, :permanent_address,
  :phone_number, :present_address, :race, :religion, :sex, :student_id, :title, :other_skills
  validates_length_of :id_card_no, :is => 13
  validates_length_of :student_id, :is => 9
  validates_numericality_of :id_card_no, :student_id, :gpa, :emergency_phone
  validates_format_of :email,:emergency_email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :on => :create
  validates_length_of :firstname, :lastname, :firstname_th, :lastname_th, :within => 2..30, :too_long => "is too long.", :too_short => "is too short."


end

